package com.horizon.manage.endpoint.converter;

import com.horizon.common.converter.HorizonBaseEvdConverter;
import com.horizon.manage.endpoint.dto.EndpointDTO;
import com.horizon.manage.endpoint.entity.Endpoint;
import com.horizon.manage.endpoint.vo.EndpointVO;
import org.springframework.stereotype.Component;

/**
 * 终端实体、VO、DTO转换器.
 *
 * @author zhaoshb
 * @since 2022/12/21 21:16
 */
@Component
public class EndpointEvdConverter extends HorizonBaseEvdConverter<Endpoint, EndpointVO, EndpointDTO> {

    @Override
    public Endpoint dtoToEntity(EndpointDTO dto) {
        Endpoint endpoint = new Endpoint();
        endpoint.setId(dto.getId());
        endpoint.setName(dto.getName());
        endpoint.setEndpointUserId(dto.getEndpointUserId());
        endpoint.setTenantId(dto.getTenantId());
        return endpoint;
    }

    @Override
    public EndpointVO entityToVO(Endpoint entity) {
        EndpointVO vo = new EndpointVO();
        vo.setId(entity.getId());
        vo.setEndpointUserId(entity.getEndpointUserId());
        vo.setName(entity.getName());
        return vo;
    }
}
